home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.image.ImageObserver;
- import java.util.Random;
-
- public class RainbowBorderPanel2 extends DynamicBorderPanel2 {
- Random randomizer;
- Color[] theColors;
- int index;
- Image osImage;
- Graphics osg;
-
- void GetParameters(Applet var1, int var2) {
- String var3 = var1.getParameter("rainbowBorderThickness" + var2);
- ((BorderPanel2)this).SetThickness(AppletParam2.GetInt(var3, 5));
- var3 = var1.getParameter("rainbowBorderBkColor" + var2);
- ((BorderPanel2)this).SetBackgroundColor(AppletParam2.GetColor(var3, (Color)null));
- var3 = var1.getParameter("rainbowBorderBkImage" + var2);
- ((BorderPanel2)this).SetBackgroundImage(AppletParam2.GetImage(var1, var3));
- }
-
- public RainbowBorderPanel2(Applet var1, int var2) {
- this.GetParameters(var1, var2);
- this.randomizer = new Random();
- this.theColors = new Color[16];
- this.theColors[0] = new Color(0, 0, 0);
- this.theColors[1] = new Color(128, 0, 0);
- this.theColors[2] = new Color(0, 128, 0);
- this.theColors[3] = new Color(128, 128, 0);
- this.theColors[4] = new Color(0, 0, 128);
- this.theColors[5] = new Color(128, 0, 128);
- this.theColors[6] = new Color(0, 128, 128);
- this.theColors[7] = new Color(128, 128, 128);
- this.theColors[8] = new Color(192, 192, 192);
- this.theColors[9] = new Color(255, 0, 0);
- this.theColors[10] = new Color(0, 255, 0);
- this.theColors[11] = new Color(255, 255, 0);
- this.theColors[12] = new Color(0, 0, 255);
- this.theColors[13] = new Color(255, 0, 255);
- this.theColors[14] = new Color(0, 255, 255);
- this.theColors[15] = new Color(255, 255, 255);
- }
-
- void DoPaint(Graphics var1) {
- if (this.osImage == null) {
- this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.osg = this.osImage.getGraphics();
- }
-
- this.index = Math.abs(this.randomizer.nextInt()) % 16;
- this.osg.setColor(this.theColors[this.index]);
-
- for(int var2 = 0; var2 < super.thickness; ++var2) {
- this.osg.drawRect(var2, var2, ((Component)this).size().width - var2 * 2, ((Component)this).size().height - var2 * 2);
- }
-
- var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
- }
-
- void DoResize(int var1, int var2) {
- this.osImage = null;
- this.osg = null;
- }
- }
-